package com.cxyd.modules.log.controller;

import com.cxyd.modules.log.service.SysLogErrorService;
import com.cxyd.common.page.PageData;
import com.cxyd.common.utils.Result;
import com.cxyd.modules.log.dto.SysLogErrorDTO;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;


/**
 * 异常日志
 */
@RestController
@RequestMapping("sys/log/error")
public class SysLogErrorController {
    private final SysLogErrorService sysLogErrorService;

    public SysLogErrorController(SysLogErrorService sysLogErrorService) {
        this.sysLogErrorService = sysLogErrorService;
    }

    @GetMapping("page")
    @RequiresPermissions("sys:log:error")
    public Result<PageData<SysLogErrorDTO>> page(@RequestParam Map<String, Object> params){
        PageData<SysLogErrorDTO> page = sysLogErrorService.page(params);

        return new Result<PageData<SysLogErrorDTO>>().ok(page);
    }
}